import { createRouter, createWebHashHistory } from "vue-router";

const routes = [
    {
        path: '/',
        redirect: '/homepage'
    },
    {
        path: '/homepage',
        name: 'Homepage',
        meta: {
            title: '首页'
        },
        component: () => import('../views/homepage.vue')
    },
    {
        path: '/statusMonitor',
        name: 'StatusMonitor',
        meta: {
            title: '状态监测'
        },
        component: () => import('../views/StatusMonitorPage.vue')
    },
    {
        path: '/faultDiagnosis',
        name: 'FaultDiagnosis',
        meta: {
            title: '故障诊断'
        },
        component: () => import('../views/FaultShow.vue')
    },    {
        path: '/sensor',
        name: 'Sensor',
        meta: {
            title: '传感器信息'
        },
        component: () => import('../views/SensorInfo.vue')
    },
    {
        path: '/MaintenanceManagement',
        name: 'MaintenanceManagement',
        meta: {
            title: '维修管理'
        },
        component: () => import('../views/MaintenanceManagement/MaintenanceManagement.vue')
    },
    {
        path: '/Alarm',
        redirect: '/Alarm/index',
        hidden: true,
        children: [
            {
                path: 'index',
                component: () => import('@/views/Alarm/index'),
                name: 'AlarmIndex',
                meta: { title: '预警管理' }
            },
            { path: '/details/:id',
                component: () => import('@/views/Alarm/detailPage'),
                name: 'DetailPage',
                meta: { title: '预警详情' }
            }
        ]
    },

    {
        path: '/EquipmentInformation',
        redirect: '/EquipmentInformation/defaultShow',
        hidden: true,
        children: [
            {
                path: 'defaultShow',
                component: () => import('@/views/EquipmentInformation/equipmentInformation'),
                name: 'EquipmentInformationDefaultShow',
                meta: { title: '设备信息管理' }
            },
            { path: '/detailInformation/:deviceCodes+',
                component: () => import('@/views/EquipmentInformation/detialInformation'),
                name: 'detialInformation',
                meta: { title: '设备详情' },
                props: true
            }
        ]
    },


    {
        path: '/systemAdministration',
        name: 'systemAdministration',
        meta: {
            title: '系统管理'
        },
        component: () => import('../views/SystemAdministration/SystemAdministration.vue')
    },
    {
        path: '/deviceInformationManagement',
        name: 'DeviceInformationManagement',
        meta: {
            title: '设备信息管理'
        },
        component: () => import('../views/DeviceInfo.vue')
    },
    {
        path: '/sensorManagement',
        name: 'SensorManagement',
        meta: {
            title: '传感器管理'
        },
        component: () => import('../views/SystemAdministration/SensorManagement.vue')
    },

    {
        path: '/monitoringEarlyWarning',
        name: 'monitoringEarlyWarning',
        meta: {
            title: '监测预警'
        },
        component: () => import('../views/MonitoringEarlyWarning/StatusMonitorPage.vue')
    },

    {
        path: '/deviceInformation',
        name: 'deviceInformation',
        meta: {
            title: '设备信息'
        },
        component: () => import('../views/EquipmentInformation/DeviceInformation.vue')
    },
];

const router = createRouter({
    history: createWebHashHistory(),
    routes
});

//导出路由
export default router;